package me.idashu.attg.service;

import java.util.List;
import java.util.Map;

import me.idashu.attg.domain.GoodsEntity;
import me.idashu.attg.domain.PageEntity;
import me.idashu.attg.persistence.GoodsMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;
    
    public void insertGoodsEntity(GoodsEntity goodsEntity){
    	goodsMapper.insertGoodsEntity(goodsEntity);
    }
    
    public void deleteGoodsEntity(int goodsId){
    	goodsMapper.deleteGoodsEntity(goodsId);
    }
    
    public GoodsEntity getGoodsEntityById(int goodsId){
    	GoodsEntity goodsEntity = goodsMapper.getGoodsEntityById(goodsId);
    	return goodsEntity;
    }
    
    public List<GoodsEntity> getGoodEntityByPage(Map<String, Object> map){
    	List<GoodsEntity> listGoods = goodsMapper.getGoodEntityByPage(map);
    	return listGoods;
    }
    
    public int getCountGoodEntity(GoodsEntity goodsEntity){
    	int count = goodsMapper.getCountGoodEntity(goodsEntity);
    	return count;
    }
    
    public List<GoodsEntity> getListGoodsEntity(Map<String, Object> map){
    	List<GoodsEntity> listGoods = goodsMapper.getListGoodsEntity(map);
    	return listGoods;
    }
    
    public int getCountListGoodsEntity(GoodsEntity goodsEntity){
    	int count = goodsMapper.getCountListGoodsEntity(goodsEntity);
    	return  count;
    }
	
    public GoodsEntity getGoodsInfoById(int goodsId){
    	GoodsEntity goodsEntity = goodsMapper.getGoodsInfoById(goodsId);
    	return goodsEntity;
    }
    
    public void updateGoodsStatus(GoodsEntity goodsEntity){
    	goodsMapper.updateGoodsStatus(goodsEntity);
    } 
    public GoodsEntity getGoodsEntityInfo(int goodsId){
    	GoodsEntity goodsEntity = goodsMapper.getGoodsEntityInfo(goodsId);
    	return goodsEntity;
    }
    
    public void updateGoodsEntityInfo(GoodsEntity goodsEntity){
    	goodsMapper.updateGoodsEntityInfo(goodsEntity);
    }
    
    public void updateGoodIsGroup(GoodsEntity goodsEntity){
    	goodsMapper.updateGoodIsGroup(goodsEntity);
    }
    
    public List<GoodsEntity> getHotGoodsEntity(PageEntity pageEntity){
    	List<GoodsEntity> listGoods = goodsMapper.getHotGoodsEntity(pageEntity);
    	return listGoods;
    }
    
    public int getHotGoodsEntity(){
    	int count = goodsMapper.getCountHotGoodsEntity();
    	return count;
    }
    
    public List<GoodsEntity> getSearchGoodsEntity(GoodsEntity goodsEntity){
    	List<GoodsEntity> listGoods = goodsMapper.getSearchGoodsEntity(goodsEntity);
    	return listGoods;
    }
    
    public void updateSendGoods(GoodsEntity goodsEntity){
    	goodsMapper.updateSendGoods(goodsEntity);
    }
    
    public GoodsEntity getGoodsEntityBySeq(int goodsSeq){
    	GoodsEntity goodsEntity = goodsMapper.getGoodsEntityBySeq(goodsSeq);
    	return  goodsEntity;
    }
}
